- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 26
chore(server): use lib to call GitHub to list available versions #1920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
0b3a860    to
    d733110      
    Compare
  
            
          
                ...al/src/test/kotlin/io/github/typesafegithub/workflows/shared/internal/model/GithubApiTest.kt
          
            Show resolved
            Hide resolved
        
      6268bad    to
    9a774c9      
    Compare
  
    | @LeoColman could you resolve conflicts? | 
9a774c9    to
    0766641      
    Compare
  
    | @krzema12 Done | 
| The tests are failing, let me know if you need help figuring out why. | 
- Replace manual HTTP client implementation with `kohsuke.github` library. - Simplify `fetchAvailableVersions` logic and remove redundant dependencies. - Refactor tests to use `kotest` with `MockServer` for more concise and structured testing. - Update dependencies and remove unused code.
bd7013e    to
    4a918ee      
    Compare
  
    | Let me take it from here, thank you 🙇 | 
| } | ||
| }.build() | ||
| val repository = github.getRepository("$owner/$name") | ||
| val apiTags = repository.getRefs("tags").refsStartingWithV().map { Version(it) } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FTR, it turned out that the lib doesn't support matching-refs API: https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#list-matching-references. Even though it's easy to emulate, I'd like to try staying with it. I'll thus look at contributing support for it to the lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a feature request in hub4j/github-api#2155.
| response.body() | ||
| } | ||
| }.build() | ||
| val repository = github.getRepository("$owner/$name") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FTR, it turned out that merely getting a reference to a repo makes another API call. I don't like it. I'll see how easy it is to disable this behavior in the lib.
kohsuke.githublibrary.fetchAvailableVersionslogic and remove redundant dependencies.kotestwithMockServerfor more concise and structured testing.